package com.ease.common.lang;

/**
 * 
 * @author nathanleewei
 * 
 * @param <V>
 */
public abstract class LazyLoadCallback<V> {

	/**
	 *
	 */
	public abstract void init();

	/**
	 *
	 */
	public abstract V get();

	/**
	 * double lock check
	 * 
	 * @param object
	 */
	public void execute(Object object) {

		V value = get();
		if (null == value) {
			synchronized (object.getClass()) {
				V value2 = get();
				if (null == value2) {
					synchronized (object.getClass()) {
						init();
					}
				}
			}
		}

	}

}
